package com.shuqi.model.parse.parser;

import org.xml.sax.Attributes;

import com.shuqi.model.bean.UserBookData;
import com.shuqi.model.parse.HandlerBase;

public class AccountUserAgeParser extends HandlerBase {
private UserBookData data;

    public UserBookData getParsedData() {
        return data;
    }

    @Override
    public void startElement(String uri, String localName, String qName, Attributes atts) {
        if ("serverInfo".equals(localName)) {
            data = new UserBookData();
            data.setState(Integer.valueOf(isNull(atts, "state")));
            data.setMessage(isNull(atts, "message"));
        }else if("userInfo".equals(localName)){
            if(data!=null && data.getState() == RESPONSE_CODE_200){
                data.setState(Integer.valueOf(isNull(atts, "state")));
                data.setMessage(isNull(atts, "message"));
                if(data.getState() == RESPONSE_CODE_200){
                    data.setBookAge(Integer.valueOf(isNull(atts, "bookAge")));
                    data.setBookPoint(Integer.valueOf(isNull(atts, "userPoint")));
                }
            }
        }
    }
}
